package com.echo.util;


public class ResultUtils {
	
	// 成功
	public static final int WEB_SUCCESS_CODE = 200;
	
	// 失败
	public static int WEB_FAILED_CODE = 400;
	
	public static int RADIO_SERVICE_IS_STOPED = 300;
	
	public static int WEB_PASSWORD_ERROR_CODE = 4001;
	
	public static String WEB_PASSWORD_ERROR_MSG="账号或密码错误！";
	
	public static int WEB_USERNAME_ERROR_CODE = 4002;
	
	public static String WEB_USERNAME_ERROR_MSG = "此账户不存在！";
	// 用户名或密码错误
	public final static int WEB_LOGIN_FAILED_CODE = 401;

	private static final String RADIO_SERVICE_IS_STOPED_MSG = "电台服务终止，请联系管理员！";

	// 操作缺少权限
	public static int WEB_UNAUTH_ERROR_CODE = 402;
	
	// 操作缺少权限
	public static int WEB_UNLOGIN_ERROR_CODE = 403;
	
	// 操作缺少权限
	public static int WEB_LACKAUTHORITY_ERROR_CODE = 413;
	
	// 操作处理失败
	public static int WEB_DB_SERVER_ERROR_CODE = 408;
	
	// 数据参数错误
    public static int WEB_PARAM_ERROR_CODE = 702;
    
    public static int WEB_UNEXIT_ERROR_CODE = 703;
    
    public static String WEB_UNEXIT_ERROR_MESSAGE = "实体不存在，请联系管理员！";
    
    public static String WEB_LOGIN_PARAM_ERROR_MESSAGE = "用户名或密码错误！";

    public static String WEB_SUCCESS_MSG = "成功";
    
    public static String WEB_FAILED_MSG = "失败";
    
    public static String WEB_UNAUTH_ERROR_MSG = "操作缺少权限,请联系管理员！";
    
    public static String WEB_DB_SERVER_ERROR_MSG = "操作处理失败，请联系管理员！";
    
    public static String WEB_LACKAUTHORITY_ERROR_MSG = "操作缺少后台管理权限,请联系管理员";
    
    public static String WEB_PARAM_ERROR_MSG = "参数错误，请检查！";
    
 	public static String WEB_UNLOGIN_ERROR_MSG = "当前登录已失效，请刷新页面重新登录！";
 	
 	public static String RESOURCE_LENGTH_ERROR_MSG = "文件太大或太小！";
    
    public static JSONResult instJSONResult(int resultCode){
    	String code = String.valueOf(resultCode);
    	String msg = "";    	
		switch (resultCode) {
		case 200:			
			msg = WEB_SUCCESS_MSG;
			break;
		case 300:
			msg = RADIO_SERVICE_IS_STOPED_MSG;
			break;
		case 400:
			msg = WEB_FAILED_MSG;
			break;
		case 4001:
			msg = WEB_PASSWORD_ERROR_MSG;
			break;
		case 4002:
			msg = WEB_USERNAME_ERROR_MSG;
			break;
		case WEB_LOGIN_FAILED_CODE:
			msg = WEB_LOGIN_PARAM_ERROR_MESSAGE;
			break;
		case 402:
			msg = WEB_UNAUTH_ERROR_MSG;
			break;
		case 403:
			msg = WEB_UNLOGIN_ERROR_MSG;
			break;
		case 413:
			msg = WEB_LACKAUTHORITY_ERROR_MSG;
			break;
		case 408:
			msg = WEB_DB_SERVER_ERROR_MSG;
			break;
		case 708:
			msg = WEB_UNEXIT_ERROR_MESSAGE;
			break;
		case 702:
			msg = WEB_PARAM_ERROR_MSG;
			break;
		case 2046:
			msg = RESOURCE_LENGTH_ERROR_MSG;
			break;
		}
    	return new JSONResult(code,msg);
    }
    public static JSONResult JSONResultParamMSG(String Errormsg){
    	
		String code = "702";
    	return new JSONResult(code,Errormsg);
    }
    public static JSONResult JSONResultParamMSG(Integer errorcode,String Errormsg){
		String code = errorcode.toString();
    	return new JSONResult(code,Errormsg);
    }
}
